/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Ventanas;

import javax.swing.JOptionPane;

/**
 *
 * @author USUARIO
 */
public class panIngresoDatos extends javax.swing.JPanel {

    /**
     * Creates new form panIngresoDatos
     */
    public panIngresoDatos() {
        initComponents();
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnGuardarysalir = new javax.swing.JButton();
        btnguardarcontinuar = new javax.swing.JButton();
        btncancelar = new javax.swing.JButton();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox1 = new javax.swing.JComboBox();
        lblnit = new javax.swing.JLabel();
        lblmunicipio = new javax.swing.JLabel();
        lbldepartamento = new javax.swing.JLabel();
        txbnombre = new javax.swing.JTextField();
        txbcodigo = new javax.swing.JTextField();
        lblcodigo = new javax.swing.JLabel();
        txbnit = new javax.swing.JTextField();
        lblnombre = new javax.swing.JLabel();
        lblapellido = new javax.swing.JLabel();
        txbapellido = new javax.swing.JTextField();

        setBackground(new java.awt.Color(253, 245, 224));
        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        addContainerListener(new java.awt.event.ContainerAdapter() {
            public void componentAdded(java.awt.event.ContainerEvent evt) {
                formComponentAdded(evt);
            }
        });

        btnGuardarysalir.setBackground(new java.awt.Color(255, 255, 255));
        btnGuardarysalir.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btnGuardarysalir.setForeground(new java.awt.Color(102, 51, 255));
        btnGuardarysalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/milky_blue.png"))); // NOI18N
        btnGuardarysalir.setText("Guardar y salir");
        btnGuardarysalir.setToolTipText("Guardar Datos y salr");
        btnGuardarysalir.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnGuardarysalirMouseClicked(evt);
            }
        });

        btnguardarcontinuar.setBackground(new java.awt.Color(255, 255, 255));
        btnguardarcontinuar.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btnguardarcontinuar.setForeground(new java.awt.Color(102, 51, 255));
        btnguardarcontinuar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/choko_crema.png"))); // NOI18N
        btnguardarcontinuar.setText("Guardar y continuar");
        btnguardarcontinuar.setToolTipText("ingresar telefono");
        btnguardarcontinuar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnguardarcontinuarMouseClicked(evt);
            }
        });
        btnguardarcontinuar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnguardarcontinuarActionPerformed(evt);
            }
        });

        btncancelar.setBackground(new java.awt.Color(255, 255, 255));
        btncancelar.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        btncancelar.setForeground(new java.awt.Color(102, 51, 255));
        btncancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cream_choco.png"))); // NOI18N
        btncancelar.setText("Cancelar");
        btncancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btncancelarMouseClicked(evt);
            }
        });

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        lblnit.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblnit.setForeground(new java.awt.Color(102, 51, 255));
        lblnit.setText("Nit");

        lblmunicipio.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblmunicipio.setForeground(new java.awt.Color(102, 51, 255));
        lblmunicipio.setText("Municipio");

        lbldepartamento.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lbldepartamento.setForeground(new java.awt.Color(102, 51, 255));
        lbldepartamento.setText("Departamento");

        lblcodigo.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblcodigo.setForeground(new java.awt.Color(102, 51, 255));
        lblcodigo.setText("Codigo");

        lblnombre.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblnombre.setForeground(new java.awt.Color(102, 51, 255));
        lblnombre.setText("Nombre");

        lblapellido.setFont(new java.awt.Font("Arial Unicode MS", 1, 12)); // NOI18N
        lblapellido.setForeground(new java.awt.Color(102, 51, 255));
        lblapellido.setText("Apellido");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblcodigo)
                    .addComponent(lblnombre)
                    .addComponent(lblapellido)
                    .addComponent(lblnit)
                    .addComponent(lbldepartamento)
                    .addComponent(lblmunicipio))
                .addGap(61, 61, 61)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txbcodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txbnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txbapellido, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txbnit, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(113, 113, 113)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnguardarcontinuar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnGuardarysalir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btncancelar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(608, 608, 608))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblcodigo)
                            .addComponent(txbcodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(20, 20, 20)
                                .addComponent(lblnombre))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txbnombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addComponent(lblapellido))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(txbapellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(8, 8, 8)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblnit)
                            .addComponent(txbnit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(13, 13, 13)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbldepartamento)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblmunicipio)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnGuardarysalir)
                        .addGap(18, 18, 18)
                        .addComponent(btnguardarcontinuar)
                        .addGap(18, 18, 18)
                        .addComponent(btncancelar)))
                .addContainerGap(105, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btnGuardarysalirMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnGuardarysalirMouseClicked
        // TODO add your handling code here:
        if(Validar()){
           JOptionPane.showMessageDialog(this,"Datos Guardados");
                 this.removeAll();
        this.updateUI();
        }else{
            JOptionPane.showMessageDialog(this,"No se han ingresado todos los campos");
        }
    }//GEN-LAST:event_btnGuardarysalirMouseClicked

    private void btncancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btncancelarMouseClicked
        // TODO add your handling code here:
                      this.removeAll();
        this.updateUI();
    }//GEN-LAST:event_btncancelarMouseClicked

    private void btnguardarcontinuarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnguardarcontinuarMouseClicked
        // TODO add your handling code here:
            if(Validar()){
           JOptionPane.showMessageDialog(this,"Datos Guardados");
             this.removeAll();
       this.add(new panotrosdatoscliente());
       this.updateUI();
        }else{
            JOptionPane.showMessageDialog(this,"No se han ingresado todos los campos");
        }
    }//GEN-LAST:event_btnguardarcontinuarMouseClicked

    private void formComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_formComponentAdded
        // TODO add your handling code here:
    
    }//GEN-LAST:event_formComponentAdded

    private void btnguardarcontinuarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarcontinuarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnguardarcontinuarActionPerformed
/***
 * Metodo que permite verificar si todos los datos 
 * ya se ingresaron en el formulario
 * @return true si fueron ingresados, false si no fueron ingresados
 */
    public boolean Validar(){
if(txbnombre.getText().equals("") | txbapellido.getText().equals("") | txbnombre.getText().equals("") | txbnit.getText().equals("") | jComboBox1.getSelectedIndex()==-1 | jComboBox2.getSelectedIndex()==-1  )
return false;
return true;
}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGuardarysalir;
    private javax.swing.JButton btncancelar;
    private javax.swing.JButton btnguardarcontinuar;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel lblapellido;
    private javax.swing.JLabel lblcodigo;
    private javax.swing.JLabel lbldepartamento;
    private javax.swing.JLabel lblmunicipio;
    private javax.swing.JLabel lblnit;
    private javax.swing.JLabel lblnombre;
    private javax.swing.JTextField txbapellido;
    private javax.swing.JTextField txbcodigo;
    private javax.swing.JTextField txbnit;
    private javax.swing.JTextField txbnombre;
    // End of variables declaration//GEN-END:variables
}
